<!--
 * @Author: 冯尚新 fengshangxin@yunjinhz.com
 * @Date: 2023-05-23 10:51:57
 * @LastEditors: 冯尚新 fengshangxin@yunjinhz.com
 * @LastEditTime: 2023-05-30 20:46:13
 * @FilePath: \zmglpt-ui-mobile-v1.1\dev\pages\internal\docFrame\components\excHandle.vue
 * @Description: 异常处文书展示项
-->
<template>
  <view>
    <u-form :model="docInfo" ref="uForm" label-position="top">
      <view class="doc-head">
        {{ docInfo.fullDocNo }}
      </view>
      <u-form-item
        label="异常情况名称"
        prop="excName"
      >
        <view>{{ docInfo.excName }}</view>
      </u-form-item>
      <u-form-item
        label="登记日期"
        prop="excRegDate"
      >
        <view>{{ docInfo.excRegDate }}</view>
      </u-form-item>
      <u-form-item
        label="登记人员"
        prop="supvPerson"
      >
        <view>{{ docInfo.supvPerson }}</view>
      </u-form-item>
      <u-form-item
        label="监管对象"
        prop="excType"
      >
        <view>{{ docInfo.excType | getDictName($u.dic.DIC_KEYS.I_WR_BUS_TYPE,docInfo.excType) }}</view>
      </u-form-item> 
      <u-form-item
        label="问题环节"
        prop="excLink"
      >
        <view>{{ docInfo.excLink | getDictName($u.dic.DIC_KEYS.I_EXC_LINK,docInfo.excLink) }}</view>
      </u-form-item>
      <u-form-item
        label="问题日期"
        prop="excDate"
      >
        <view>{{ docInfo.excDate&&docInfo.excDate.substring(0,10) }}</view>
      </u-form-item>
      <u-form-item
        label="线索来源"
        prop="excSource"
      >
        <view>
          {{ docInfo.excSource| getDictName($u.dic.DIC_KEYS.I_EXC_SOURCE,docInfo.excSource) }}
        </view>
      </u-form-item>
      <u-form-item
        label="线索类型"
        prop="clueType"
      >
        <view>{{ docInfo.clueType }}</view>
      </u-form-item>
      <u-form-item
        label="异常情况描述"
        prop="excDesc"
      >
        <view>{{ docInfo.excDesc }}</view>
      </u-form-item>
      <u-form-item
        label="涉及调查对象基本情况"
        prop="excRetailerDetail"
      >
        <u-input
          :disabled="isdisable"
          type="textarea"
          v-model="docInfo.excRetailerDetail"
        />
      </u-form-item>
      <u-form-item
        label="调查意见"
        prop="surveyAdvise"
      >
        <view>{{ docInfo.surveyAdvise }}</view>
      </u-form-item>
      <u-form-item
        label="调查方式"
        prop="surveyType"
      >
        <view>{{ dtlList.surveyType | getDictName($u.dic.DIC_KEYS.I_HANDLE_TYPE,dtlList.surveyType) }}</view>
      </u-form-item>
      <u-form-item
        label="调查人员"
        prop="surveyPersonName"
      >
        <view>{{ dtlList.surveyPersonName }}</view>
      </u-form-item>
      <u-form-item
        label="要求反馈日期"
        prop="fbLimitDate"
      >
        <view>{{ dtlList.fbLimitDate&&dtlList.fbLimitDate.substring(0,10) }}</view>
      </u-form-item>
      <u-form-item label="生成实地核查任务" prop="isAudit">
        <u-switch v-model="dtlList.isAudit" @change="handleSwitch" :disabled="isdisable"></u-switch>
      </u-form-item>
      <view 
        v-if="dtlList.fieldCheckAnnalList&&dtlList.fieldCheckAnnalList.length>0"
      >
        <u-card 
          class="fieldList"
          v-for="item in dtlList.fieldCheckAnnalList"
          :key="item.licNo"
          :title="item.licNo" 
          :sub-title="item.statusName"
          :body-style="{padding:'20rpx'}"
          :head-style="{padding:'20rpx'}"
          box-shadow="#e5e5e5 0px 0px 50px"
        >
          <view class="field-content" slot="body">
            <view>
              <u-row>
                <u-col span="12" class="field-row-title" style="padding-top:5px;padding-bottom:5px;">
                  {{ item.customerName }}
                </u-col>
              </u-row>
            </view>
            <view>
              <u-row>
                <u-col span="6">
                  <u-icon color="#2979ff" name="account" :label="item.sender"></u-icon>
                </u-col>
                <u-col span="6">
                  <u-icon color="#ff9900" name="home" :label="item.verificationDepartment"></u-icon>
                </u-col>
              </u-row>
            </view>
          </view>
        </u-card>
      </view>
      <u-form-item
        label="附件信息"
      >
        <upload-images
          :url="uploadFile"
          :length="10"
          :extForm="{ fiGroupCode: 'zmng-images', bizId:documentDoc.docInsUuid }"
          :del-url="delUrl"
          :bizId="documentDoc.docInsUuid"
          :can-add="false"
          :can-del="false"
          :renderImages="renderImages"
          ref="saveModel3"
        >
        </upload-images>
      </u-form-item>
    </u-form>
  </view>
</template>

<script>
import store from '@/store';
import commonService from "@/service/internal/common.service";
import uSwitch from '@/uview-ui/components/u-switch/u-switch.vue';
import { UploadImages, } from "@/components";
export default {
  name: "ExcHandle",
  components: {  UploadImages,uSwitch, },
  filters:{
    getDictName(value,dicName){
      if (!value) return ''
      if (!dicName) return ''
      console.log(dicName,store.state.dicts[dicName]);
      return store.state.dicts[dicName].filter(d => d.bcbCode === value)[0].bcbName;
    },
  },
  props:{
    docIns:{
      type:Object,
      default:() => ({}),
    },
    documentDoc:{
      type:Object,
      default:() => ({}),
    },
  },
  data() {
    return {
      isdisable:true,
      docInfo: {},
      dtlList:{},
      uploadFile: commonService.uploadFile,
      delUrl: commonService.deleteFile,
    };
  },
  watch: {
    docIns: {
      immediate: true,
      handler(v) {
        console.log("文书信息", v);
        this.docInfo = {...v,};
        console.log(this.docInfo);
        if(this.docInfo.dtlList && this.docInfo.dtlList.length > 0){
          this.dtlList = this.docInfo.dtlList[0]
        }
        console.log("查看实地核查列表数据",this.dtlList.fieldCheckAnnalList)
      },
    },
    documentDoc:{
      immediate: true,
      handler(v) {
        console.log("byID", v);
      },
    },
  },
  mounted(){
  },
  methods: {
    handleSwitch(sw) {
      this.radioCheckWrap = sw;
    },
    renderImages(id) {
      return commonService.findFilesByBizId(id.bizId).then(r => {
        r.data.forEach(i => {
          i.src = `${commonService.downloadFile}?fileId=${i.gfiId}&tk=${uni.getStorageSync("tk")}`;
          i.filePath = i.src;
        });
        return r.data;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
/deep/ .u-form-item--left__content__label {
  color: #666;
}
.fieldList{
  margin-right: 0rpx;
}
.field-content-row{
  display: flex;
  flex-direction: column;
  margin-bottom: 10rpx;
}
.field-row-title{
  color: #191f25;
  font-weight: bold;
}
.doc-head {
  color: #191f25;
  font-weight: bold;
  font-size: 28rpx;
  text-align: center;
}
.unique-form /deep/ .u-form-item--right__content__slot {
  flex-direction:column
}
.unique-form /deep/.unique-textarea{
 width: 100%;
 height: 80rpx;
}
</style>